package gov.kqqzyyy.monkey.radiologyscreen.mytools;

import android.app.Application;
import android.content.Context;

import com.socks.library.KLog;

import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import gov.kqqzyyy.monkey.radiologyscreen.BuildConfig;

/**
 * Created by Monkey on 2017/9/7.
 * 存储全局变量
 */

public class MyApplication extends Application {

    private SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
    private SimpleDateFormat sdfWeekDay = new SimpleDateFormat("yyyy年MM月dd日EEEEHH:mm:ss", Locale.CHINA);
    private SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
    private SimpleDateFormat TsdfDateTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.CHINA);
    private SimpleDateFormat sdfTime = new SimpleDateFormat("HH:mm:ss", Locale.CHINA);

    private Map<String, String> deviceInfos;// 用来存储设备信息和异常信息

    private String versionName = "0.0.0";

    public static Context applicationContext;

    @Override
    public void onCreate() {
        super.onCreate();
        KLog.init(BuildConfig.LOG_DEBUG);
//        CrashHandler.getInstance().init(this);
        applicationContext = this;
    }

    public SimpleDateFormat getSdfDateTime() {
        return sdfDateTime;
    }

    public SimpleDateFormat getTsdfDateTime() {
        return TsdfDateTime;
    }

    public SimpleDateFormat getSdfWeekDay() {
        return sdfWeekDay;
    }

    public SimpleDateFormat getSdfTime() {
        return sdfTime;
    }

    public String getVersionName() {
        return versionName;
    }

    public void setVersionName(String versionName) {
        this.versionName = versionName;
    }

    public Map<String, String> getDeviceInfos() {
        if (deviceInfos == null) {
            return new HashMap<>();
        }
        return deviceInfos;
    }

    public void setDeviceInfos(Map<String, String> deviceInfos) {
        this.deviceInfos = deviceInfos;
    }

    public SimpleDateFormat getSdfDate() {
        return sdfDate;
    }
}
